<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:84:"D:\phpstudy\PHPTutorial\WWW\farm\farm_sink/application/index\view\reals\bangcai.html";i:1569293860;s:82:"D:\phpstudy\PHPTutorial\WWW\farm\farm_sink/application/index\view\common\head.html";i:1555643468;}*/ ?>
<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>农厂汇小程序管理中心</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="__STATIC__/css/font.css"> 
	<link href="/favicon.ico" type="image/x-icon" rel="shortcut icon" /> 
    <link rel="stylesheet" href="__STATIC__/css/xadmin.css">
    <link href="__STATIC__/lib/layui/css/layui.css" rel="stylesheet">
    <script type="text/javascript" src="__STATIC__/js/jquery.min.js"></script>
    <script type="text/javascript" src="__STATIC__/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__STATIC__/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script type="text/css">
      #fff{
        border: red solid 1px;
      }
    </script>
  </head>
  
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
         <a href=" <?php echo url('index/index/welcome'); ?>">首页</a>
        <a href="">演示</a>
        <a href="">
          <cite>帮你采</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so">
            <div class="layui-input-inline">

            <input type="text" name="cid" value="<?php echo (\think\Request::instance()->get('cid') !== ''?\think\Request::instance()->get('cid'):''); ?>"  placeholder="帮你采id" autocomplete="off" class="layui-input">
            <input type="text" name="uname" value="<?php echo (\think\Request::instance()->get('uname') !== ''?\think\Request::instance()->get('uname'):''); ?>"  placeholder="用户名" autocomplete="off" class="layui-input">

            <input type="text" name="phone" value="<?php echo (\think\Request::instance()->get('phone') !== ''?\think\Request::instance()->get('phone'):''); ?>"  placeholder="手机号" autocomplete="off" class="layui-input">

            <span>发布时间</span><input class="layui-input" placeholder="开始日" name="datemin" id="start">至
            <input class="layui-input" placeholder="截止日" name="datemax" id="end">
            <input type="submit" name="sub" class="layui-btn" value="开始搜索" lay-submit="" lay-filter="sreach">
            </div>
        </form>
    </div>
    <xblock>
        <button class="layui-btn layui-bg-orange" onclick="x_admin_show('帮你采设置','<?php echo url('index/reals/bncset'); ?>')">帮你采设置<i class="iconfont">&#xe6ae;</i></button>
        <span class="x-right" style="line-height:40px">共有数据：<?php echo $rs; ?>条</span>
    </xblock>
    <table class="layui-table">
        <thead>
        <tr>
            <th>NO</th>
            <th>帮你采ID</th><!--随你压可以改成别的，通用-->
            <th>用户ID</th>
            <th>头像</th>
            <th>手机号码</th>
            <th>姓名</th>
            <th>提交时间</th>
            <th>操作</th>
        </thead>
        <tbody>
        <?php if(is_array($res) || $res instanceof \think\Collection || $res instanceof \think\Paginator): $i = 0; $__LIST__ = $res;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$res): $mod = ($i % 2 );++$i;?>
        <tr>
            <td><?php echo $key+1; ?></td>
            <td ><?php echo $res['id']; ?></td>
            <td ><?php echo $res['uid']; ?></td>
         <td><?php if($res['avatars_img']==''): ?><img src="<?php echo $res['head_portrait']; ?>" width="40"><?php else: ?><img src="/upload/portrait/<?php echo $res['avatars_img']; ?>" width="40"><?php endif; ?></td>
            <td><?php echo $res['phone']; ?></td>
            <td><?php if($res['uname']==""): ?><?php echo $res['nickname']; else: ?><?php echo $res['uname']; endif; ?></td>
            <td><?php echo $res['createtime']; ?></td>
            <td class="td-manage">

                <?php if($res['flg']==0): ?><a title=""  onclick="member_stop(this,'<?php echo $res['id']; ?>')" href="javascript:;" class="layui-btn layui-btn layui-btn-xs">
                <i class="layui-icon">&#xe642;</i>未处理</a>
                <?php elseif($res['flg']==1): ?><a class="layui-btn layui-btn layui-btn-xs">
                <i class="layui-icon">&#xe642;</i>已处理</a>
                <?php else: ?><a  class="layui-btn layui-btn layui-btn-xs">
                <i class="layui-icon">&#xe642;</i>用户来电</a><?php endif; ?>

            </td>
        </tr>
        <?php endforeach; endif; else: echo "" ;endif; ?>
		<tr>
		<td colspan="8"><div class="page">
				<div>
					<?php echo $page; ?>
				</div>
		   </div>
		  </td>
	</tr>
        </tbody>
    </table>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });

    /*帮你采-改变处理与为处理状态*/
    function member_stop(obj,id){
        layer.confirm('是否处理完毕？',function(index){
            $.ajax({
                url:"<?php echo URL('reals/updateflg'); ?>",//传值的方法地址
                data:{"id":id},//要传的条件
                type:"post",//传值类型
                dataType:'json',//指定返回的类型
                success:function(msg){
                    if(msg==1){
                        var html='<a class="layui-btn layui-btn layui-btn-xs"><i class="layui-icon">&#xe642;</i>已处理</a>';
                        $(obj).parents(".td-manage").append(html);
                        $(obj).remove();
                        layer.msg("处理成功",{icon:1,time:1000});
                    }else {
                        layer.msg("处理失败",{icon:2,time:1000});
                    }
                }
            })
        });
    }

    function member_del(obj,did){
        layer.confirm('确认要删除吗？',function(index){
            //window.location.href="";
            //发异步删除数据
            $.ajax({
                url:'del',
                type:'POST',
                data:{'m_id':did},
                success:function(data){
                    //alert(data);
                    setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
                        window.location.reload();//页面刷新
                    },500);                 },
                error:function(data){
                    //console.log(data);
                    alert('删除失败');
                }

            })

            //$(obj).parents("tr").remove();
            layer.msg('已删除!',{icon:1,time:1000});
        });
    }

    function delAll (argument) {

        var data = tableCheck.getData();

        layer.confirm('确认要删除吗？'+data,function(index){
            //捉到所有被选中的，发异步进行删除
            layer.msg('删除成功', {icon: 1});
            $(".layui-form-checked").not('.header').parents('tr').remove();
        });
    }
</script>

</body>

</html>